const mongoose=require("mongoose")
const  Schema=mongoose.Schema

//创建Schema(模式)对象
var userSchema=new Schema({
    username:{
        type:String,
        required:true,
        unique:true,
        index:true,
        trim:true,
    },
    password:{
        type:String,
        required:true,
        capped:20
    },
    nickname:{
        type:String,
        default:"小烦"
    }
})

//通过Schema来创建Model
var user=mongoose.model("user",userSchema)


module.exports=user